cookie_dict = {'cookie': cookie}

    cookies = requests.utils.cookiejar_from_dict(cookie_dict, cookiejar=None, overwrite=True)  # 将字典转化为cookiejar
    s = requests.session()
    s.cookies = cookies

    # 获取所有课程目录，方便选择复制，解析所有的课程

    r = s.get(url=main_pc_url_api, headers=headers_main_pc, params=params_main_pc).json()['data']['student_course']['data']
    print(f'       ***********  共有{len(r)}门课程： *****************')
    print("-----------------------------------------------------------------")
    for i in range(len(r)):
        course_info_title = r[i]['course_info']['title']
        course_id_str = r[i]['course_info']['course_id_str']
        org_name = r[i]['course_info']['org_name']
        course_title = r[i]['course_info']['course_title']
        lesson_num = r[i]['course_info']['lesson_num']
        print(f'课程名称: {org_name}-{course_info_title}-{course_title}-{lesson_num}课时------课程ID： {course_id_str}')
        with open('coursefile.txt', mode='a',encoding='ANSI') as f:
            f.write('课程名称:' + org_name + '-' + course_info_title + '-' + course_title + '-' + str(lesson_num) + '-' + '课时------课程ID： ' + course_id_str + '\n' + '\n')
